<?php
if (!defined("IN_FUSION")) { die("Access Denied"); }

openside("Users Profile Tagwall");
$result = dbquery(
	"SELECT * FROM ".DB_COMMENTS." tc
	LEFT JOIN ".DB_USERS." tu ON tc.comment_name=tu.user_id
	WHERE comment_type='PF' ORDER BY comment_datestamp DESC LIMIT 0,3"
);

if (dbrows($result)) {
	while ($data = dbarray($result)) {
		$avatar = ($data['user_avatar'] != "" ? $data['user_avatar'] : "noav.gif");
		$comment_message = preg_replace("#(\[(.*?)=(.*?)\](.*?)\[/(.*?)\]|\[(.*?)\](.*?)\[/(.*?)\])#si", "", $data['comment_message']);
                $youtube = (preg_match("#\[youtube\](.*?)\[/youtube\]#si", $comment_message) ? true : false);
		echo "<table width='100%' border='0'><tr>\n";
		echo "<td width='28'><img align='left' src='".IMAGES."avatars/".$avatar."' height='25' width='25' border='0' alt='' /></td>\n";
		echo "<td valign='middle' align='left'><a class='side' href='".BASEDIR."profile.php?lookup=".$data['comment_item_id']."'><b>".$data['user_name']."</b></a></td></tr>\n";
		echo "<tr>\n";
		echo "<td colspan='2'><img src='".THEME."images/bullet.gif' border='0' alt='' />&nbsp;<a class='side' href='".BASEDIR."profile.php?lookup=".$data['comment_item_id']."'>".strip_tags(trimlink($comment_message, 40))."</a><br /><br /></td></tr>\n";
		echo " </table>\n";
	}
} else { 
	echo "<div style='text-align:left'>No comments on the wall.</div>";
}
closeside();
?>